{% extends "base.html" %}
{% load	bootstrap3 %}
{% load i18n %}
{% load static %}

{% block  title %}{% trans 'Scheduling Logs' %}{% endblock %}
{% block header-css %}
    <link href="{% static 'css/plugins/dataTables/datatables.min.css' %}" rel="stylesheet">
{% endblock %}

{% block page-content %}
    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-lg-10">
            <h2>{% trans 'Scheduling Logs' %}</h2>
            <ol class="breadcrumb">
                <li>
                     <a href="/">{% trans 'Home' %}</a>
                </li>
                <li>
                    <a href="{% url 'audit:login-log-list' %}">{% trans 'Audits' %}</a>
                </li>
                <li class="active">
                    <strong>{% trans 'Scheduling Logs' %}</strong>
                </li>
            </ol>
        </div>
        <div class="col-lg-2">

        </div>
    </div>
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-lg-12" id="split-right">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class=""><a href="{% url 'audit:jobs_logs_command' %}"><i class="fa fa-briefcase"></i> {% trans 'Batch Cmd Logs' %}</a></li>
                        <li class=""><a href="{% url 'audit:jobs_logs_scripts' %}"><i class="fa fa-briefcase"></i> {% trans 'Batch Scripts Logs' %}</a></li>
                        <li class=""><a href="{% url 'audit:jobs_logs_files' %}"><i class="fa fa-briefcase"></i> {% trans 'File Distribution Logs' %}</a></li>
                        <li class="active"><a href="{% url 'audit:jobs_logs_scheduling' %}"><i class="fa fa-briefcase"></i> {% trans 'Batch Task Logs' %}</a></li>
                        <li class=""><a href="{% url 'audit:jobs_logs_crontab' %}">{% trans 'Crontab Task Logs' %}</a></li>
                    </ul>
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                                <div class="col-lg-6" style="padding-left:0px">
                                    <form id="date_form">
                                        {% csrf_token %}
                                        <div class="pull-left"><input type="text" class="form-control" name="name" placeholder="{% trans 'User Name' %}"> </div>
                                        <div class="input-group col-lg-offset-3">
                                            <span class="add-on input-group-addon"><i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span>
                                            <input type="text" name="date_from" class="form-control" placeholder={% trans 'Select Start Date' %} id="datetimepicker1">
                                            <span class="add-on input-group-addon"><i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span>
                                            <input type="text" name="date_to" class="form-control" placeholder={% trans 'Select End Date' %} id="datetimepicker2">
                                        </div>
                                    </form>
                                </div>
                                <div class="input-group-btn">
                                    <button type="submit" class="btn btn-primary" form="date_form">{% trans 'Query' %}</button>
                                </div>

                                <form id="del_form_asset_all" class="form-horizontal" action="" method="post">
                                    {% csrf_token %}
                                    <table class="table table-striped table-bordered table-hover dataTables-asset">
                                        <thead>
                                        <tr>
                                            <th>{% trans 'Number' %}</th>
                                            <th>{% trans 'User Name' %}</th>
                                            <th>{% trans 'Scheduling Name' %}</th>
                                            <th>{% trans 'DateTime' %}</th>
                                            <th>{% trans 'Request Meta' %}</th>
                                            <th>{% trans 'View Results' %}</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for row in loginlog_list.object_list %}
                                            <tr class="gradeA" id="{{ row.id }}">
                                            <td>{{forloop.counter}}</td>
                                            <td>{{ row.operator }}</td>
                                            <td>{{ row.job_name }}</td>
                                            <td>{{ row.start_time|date:"Y-m-d H:i:s" }}</td>
                                            <td>{{ row.get_type_display }}</td>
                                            <td><a>{% trans 'View' %}</a></td>
                                        </tr>
                                        {% endfor %}
                                        </tbody>

                                    </table>
                                    <div class="pull-right">
                                        <nav class="pagination">
                                            {% if loginlog_list.has_previous %}
                                                <li class="long"><a href="?{{ loginlog_list.previous_page_number.querystring }}">{% trans 'Home' %}</a></li>
                                            {% else %}
                                                <li><a href="{% url "audit:jobs_logs_scripts" %}?page=1">{% trans 'Home' %}</a></li>
                                            {% endif %}

                                            {% for page in loginlog_list.pages %}
                                                {% if page %}
                                                    {% ifequal page loginlog_list.number %}
                                                        <li class="active"><a href="?{{ page.querystring }}">{{ page }}</a></li>
                                                    {% else %}
                                                         <li><a href="?{{ page.querystring }}" class="page">{{ page }}</a></li>
                                                    {% endifequal %}
                                                {% else %}
                                                    <li class="none"><a href="">...</a></li>
                                                {% endif %}
                                            {% endfor %}
                                            {% if loginlog_list.has_next %}
                                                <li class="long"><a href="?{{ loginlog_list.next_page_number.querystring }}">{% trans 'Next' %}</a></li>
                                            {% endif %}
                                            <li>
                                                <a href="{% url "audit:jobs_logs_scripts" %}?page={{ loginlog_list.paginator.num_pages }}">{% trans 'Trailer' %}</a>
                                            </li>
                                                <li><span style="color: #0a0a0a">{% trans 'Total' %}: &nbsp;{{ loginlog_list.paginator.num_pages }} {% trans 'Page' %}</span>
                                            </li>
                                        </nav>
                                    </div> <!--页码 -->
                                </form>
                            </div>
                        </div>

                    </div>

                    </div>
                </div>
            </div>
        </div>
    </div>


{% endblock %}

{% block footer-js %}
    <script>
    $('.gradeA').click(function () {
        var ids = $(this).attr('id');
        $.ajax({
            headers: {"X-CSRFToken": '{{ csrf_token }}'},
            url: "{% url 'audit:jobs_scheduling_result' %}",
            type: 'POST',
            data: {'id': ids},
            success: function (data) {
                location.href= "{% url 'audit:jobs_scheduling_result' %}"+"?id="+ids;
            }
        });
    })


    </script>
    <script>
        $('#datetimepicker1').datetimepicker({
                onGenerate:function( ct ){
                $(this).find('.xdsoft_date.xdsoft_weekend')
                //      .addClass('xdsoft_disabled');
        },
        weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
        yearOffset:0,
        lang:'ch',      //中文显示
        timepicker:false,
        format:'Y-m-d',         //格式年月日
        formatDate:'Y-m-d',
    });

    $('#datetimepicker2').datetimepicker({
                onGenerate:function( ct ){
                $(this).find('.xdsoft_date.xdsoft_weekend')
                //      .addClass('xdsoft_disabled');
        },
        weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
        yearOffset:0,
        lang:'ch',      //中文显示
        timepicker:false,
        format:'Y-m-d',         //格式年月日
        formatDate:'Y-m-d',
    });
    </script>

    {% endblock %}
    {% block footer-js-ajax %}
    {% endblock %}